<template>
    <div id="app">
      <el-form ref="addUptime" :model="uptime" label-width="100px">
        <el-form-item label="用户名">
          <el-select v-model="uptime.uid" placeholder="请选择">
            <el-option
              v-for="item in memberList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-date-picker
            v-model="uptime.startTime"
            type="datetime"
            placeholder="选择开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            v-model="uptime.endTime"
            type="datetime"
            placeholder="选择开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="描述">
          <el-input v-model="uptime.description"  type="textarea" rows="5"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="save()">提交</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
      data(){
        return {
          uptime:{},
          memberList:[]
        }
      },
      created() {
        this.axios.get("/member/selectAll").then((resp)=>{
          this.memberList=resp.data;
        });
      },
      methods:{
        save(){
          //发出ajax请求
          this.axios.post("/uptime/add",this.uptime).then((resp)=>{
            this.$message.success("设置成功！");
            this.uptime={};
          })
        }
      }
    }
</script>


<style scoped>

</style>
